package org.singleton.ex4.eg4;

import java.util.HashMap;
import java.util.Map;

public class SingletonCache {
	private final static String DEFAULT_KEY = "one";
	
	private static Map<String, SingletonCache> map = new HashMap<String, SingletonCache>();
	
	private SingletonCache(){
	}
	
	public static SingletonCache getInstance(){
		SingletonCache instance = (SingletonCache)map.get(DEFAULT_KEY);
		
		if(instance == null){
			instance = new SingletonCache();
			map.put(DEFAULT_KEY,instance);
		}
		return instance;
	}
}
